﻿using UnityEngine;

using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Azuo_Tool
{
    public class RandomUtil
    {
        /// <summary>
        /// 生成随机的二维变量
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public static Vector2 RandomVec2(float x, float y)
        {
            float x_a = Random.Range(0, x);
            float y_a = Random.Range(0, y);
         
            return new Vector2(x_a, y_a);
        }

        public static Vector2 RandomVec2(float x0, float x1, float y0, float y1)
        {
            float x_a = Random.Range(x0, x1);
            float y_a = Random.Range(y0, y1);

            return new Vector2(x_a, y_a);
        }
        /// <summary>
        /// 生成随机三维变量
        /// </summary>
        /// <param name="x">x坐标</param>
        /// <param name="y">y坐标</param>
        /// <param name="z">z坐标</param>
        /// <returns>随机变量</returns>
        public static Vector3 RandomVec3(float x,float y,float z)
        {
            float x_a = Random.Range(-x,x);
            float y_a = Random.Range(-y, y);
            float z_a = Random.Range(-z, z);
            return new Vector3(x_a,y_a,z_a);
        }
    }
}
